import kshSanitationDataApi from '../../api/kshSanitationData'

export const HwMixins = {
  data() {
    return {
      hwGdccljclData: [
        {label: '餐厨废弃物进厂量', value: '-', unit: '吨'},
        {label: '废弃油脂进厂量', value: '-', unit: '吨'},
        {label: '工艺油出油量', value: '-', unit: '吨'},
        {label: '污泥产生量', value: '-', unit: '吨'},
        {label: '沼液产生量', value: '-', unit: '吨'},
        {label: '废渣产生量', value: '-', unit: '吨'},
        {label: '近一周发电量', value: '-', unit: '度'}
      ],
      hwGdfsfdcData: [
        {label: '近一周发电量', value: '-', unit: '度'},
        {label: '入炉焚烧量', value: '-', unit: '吨'},
        {label: '废渣运出量', value: '-', unit: '吨'}
      ],
      hwXltmcFzData: [
        {label: '接收车次', value: '-', unit: '次'},
        {label: '接收量', value: '-', unit: '吨'},
        {label: '处置量', value: '-', unit: '吨'}
      ],
      hwXltmcSlyData: [
        {label: '产生量', value: '-', unit: '吨'},
        {label: '处理量', value: '-', unit: '吨'},
        {label: '达标排放量', value: '-', unit: '吨'}
      ],
      hwYjswclzxDatas: []
    }
  },
  methods: {
    // 进入页面时执行
    openHwPage() {
      this.hwAllData()
    },
    hwTitleClick(type) {
      this.initAllPage()
      if (type === 'gdfsfdc') {
        this.hwGdfsfdcVisible = true
      } else if (type === 'gdccljcl') {
        this.hwGdccljclVisible = true
      } else if (type === 'yjswclzx') {
        this.hwYjswclzxVisible = true
      } else if (type === 'xltmc') {
        this.hwXltmclVisible = true
      }
    },
    hwAllData() {
      this.selectPowerStationInfo()
      this.selectKitchenWasteInfo()
      this.selectFeighInfo()
      this.selectLeachateInfo()
      this.selectOrganicInfo()
    },
    selectKitchenWasteInfo() {
      kshSanitationDataApi.selectKitchenWasteInfo()
        .then(res => {
          const data = res.data
          this.hwGdccljclData = [
            {label: '餐厨废弃物进厂量', value: data.jcl, unit: '吨'},
            {label: '废弃油脂进厂量', value: data.fqyz, unit: '吨'},
            {label: '工艺油出油量', value: data.gyycyl, unit: '吨'},
            {label: '工艺油出油率', value: data.gyycylv, unit: '%'},
            {label: '污泥产生量', value: data.wnl, unit: '吨'},
            {label: '沼液产生量', value: data.cycsl, unit: '吨'},
            {label: '废渣产生量', value: data.fzcsl, unit: '吨'},
            {label: '近一周发电量', value: data.fdl, unit: '度'},
            {label: ' ', value: ' ', unit: ' '}
          ]
        })
        .catch(() => {

        })
    },
    selectFeighInfo() {
      kshSanitationDataApi.selectFeighInfo()
        .then(res => {
          const data = res.data
          this.hwXltmcFzData = [
            {label: '接收车次', value: data.jscc, unit: '次'},
            {label: '接收量', value: data.jsl, unit: '吨'},
            {label: '处置量', value: data.czl, unit: '吨'}
          ]
        })
        .catch(() => {

        })
    },
    selectLeachateInfo() {
      kshSanitationDataApi.selectLeachateInfo()
        .then(res => {
          const data = res.data
          this.hwXltmcSlyData = [
            {label: '产生量', value: data.csl, unit: '吨'},
            {label: '处理量', value: data.cll, unit: '吨'},
            {label: '达标排放量', value: data.dbpfl, unit: '吨'}
          ]
        })
        .catch(() => {

        })
    },
    selectOrganicInfo() {
      kshSanitationDataApi.selectOrganicInfo()
        .then(res => {
          this.hwYjswclzxDatas = res.data
        })
        .catch(() => {

        })
    },
    selectPowerStationInfo() {
      kshSanitationDataApi.selectPowerStationInfo()
        .then(res => {
          const data = res.data
          this.hwGdfsfdcData = [
            {label: '近一周发电量', value: data.fdl, unit: '度'},
            {label: '入炉焚烧量', value: data.fsl, unit: '吨'},
            {label: '废渣运出量', value: data.ycl, unit: '吨'}
          ]
        })
        .catch(() => {

        })
    }
  }
}
